import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'

// 密钥对生成 http://web.chacuo.net/netrsakeypair

const publicKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDV1fMaVeVVA2zVf2ouEnwXzxd2\n' +
  'esGXuHK8uBbdQKcnvVyP07FyyXF3gu1Y7hjgRmYVDBmpn/FrfF0Z5FKMncwjpcif\n' +
  'uTDYR4fVGy9KMZpEFetPAxBT+WyX/N7TVM6la/TmbzlVOz7gjAK78n+GBMoIxC2j\n' +
  'h4QkbSCr3JbxbwkTOwIDAQAB'

// 加密
export function encrypt(txt) {
  const encryptor = new JSEncrypt()
  encryptor.setPublicKey(publicKey) // 设置公钥
  return encryptor.encrypt(txt) // 对需要加密的数据进行加密
}

